package cn.spikego.advicelite.client.core.module

import cn.spikego.advicelite.client.eventapi.EventManager

abstract class Module(
    val name: String,
    val keybind: Int,
    val description: String,
    val moduleCategory: ModuleCategory
) {
    var enabled: Boolean = false
        private set

    open fun onEnable() {
        EventManager.register(this)
    }

    open fun onDisable() {
        EventManager.unregister(this)
    }

    fun toggle() {
        enabled = !enabled
        if (enabled) {
            onEnable()
        } else {
            onDisable()
        }
    }

    fun isEnabled(): Boolean = enabled
}